package com.itheima.health.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.itheima.health.dao.QuartzDao;
import com.itheima.health.service.QuartzService;
import org.springframework.beans.factory.annotation.Autowired;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@Service
public class QuartzServiceImpl implements QuartzService {

    @Autowired
    private QuartzDao quartzDao;

    @Override
    public void clearOrderHistoryData() {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.MONTH,-1);
        SimpleDateFormat format = new SimpleDateFormat("yyyy.MM");
        Date time = calendar.getTime();
        String data = format.format(time);
        data=data+".31";
        System.out.println(data);
        quartzDao.clearOrderHistoryData(data);
    }
}
